
{include file="public/header" /}
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong class="icon-reorder"> 权限组列表</strong></div>
    <div class="padding border-bottom">
        <a class="button border-yellow" href="{:U('AdminRole/add')}"><span class="icon-plus-square-o"></span>添加</a>
    </div>
  <table id="content_table" class="table table-hover text-center">
    <tr>
      <th width="5%">ID</th>
      <th width="15%">名称</th>
     
      <th width="10%">操作</th>
    </tr>




      {foreach name='list' item='val'}
    <tr id="del_{$val.id}">
      <td> {$val.id}</td>
      <td> {$val.role_name}</td>
      <td><div class="button-group"> 
      <a class="button border-red" href="{:U('AdminRole/auth',['id'=>$val.id])}"><span class="icon-users"></span> 授权</a>
      <a class="button border-main" href="{:U('AdminRole/edit',['id'=>$val.id])}"><span class="icon-edit"></span> 编辑</a>
      <a class="button border-red" href="javascript:void(0)" onclick="del('{$val.id}')"><span class="icon-trash-o"></span> 删除</a> </div>
      </td>
    </tr>
    {/foreach}
      <tr>
        <td colspan="3">无数据</td>
      </tr>

  </table>
</div>
<script>
    function del(ids){
        if(ids==''){
            layer.msg('参数不能为空',{icon:2});
        }else{
            layer.confirm('您确定要删除吗？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                $.ajax({
                    type:"get",
                    url:"{:U('AdminRole/ajaxDelete')}",
                    data:{id:ids},
                    dataType:'json',
                    success:function(data){
                        if(data.res==1){
                            layer.msg(data.msg, {icon:1}, function(){
                                $("#content_table").find("#del_"+ids).remove();
                            });
                        }else{
                            layer.msg(data.msg,{icon:2});
                        }
                    }
                });
            }, function(){
            });
        }
    }
</script>
{include file="public/index_footer" /}
